package com.op.parcel.common.exception;


import com.op.parcel.common.api.R;
import lombok.Getter;
import lombok.Setter;

/**
 * 异常
 *
 * @author xuan🐽
 */
@Getter
@Setter
public class BusinessException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private R result;

	public BusinessException(R r) {
		super(r.getMsg());
		this.result = r;
	}

	public BusinessException(String message) {
		super(message);
		this.result = R.error(message);
	}

	public BusinessException(String code, String message) {
		super(message);
		this.result = R.error(code, message);
	}

	/**
	 * 提高性能
	 *
	 * @return Throwable
	 */
	@Override
	public Throwable fillInStackTrace() {
		return this;
	}
}
